1 /* 2 3 Boost Software License - Version 1.0 - August 17th, 2003 4 5 Permission is hereby granted, free of charge, to any person or organization 6 obtaining a copy of the software and accompanying documentation covered by 7 this license (the "Software") to use, reproduce, display, distribute, 8 execute, and transmit the Software, and to prepare derivative works of the 9 Software, and to permit third-parties to whom the Software is furnished to 10 do so, all subject to the following: 11 12 The copyright notices in the Software and this entire statement, including 13 the above license grant, this restriction and the following disclaimer, 14 must be included in all copies of the Software, in whole or in part, and 15 all derivative works of the Software, unless such copies or derivative 16 works are solely in the form of machine-executable object code generated by 17 a source language processor. 18 19 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT 22 SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE 23 FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, 24 ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 25 DEALINGS IN THE SOFTWARE. 26 27 */ 28 29 module derelict.glib.grand; 30 31 import derelict.glib.gtypes; 32 import derelict.glib.glibconfig; 33 import core.stdc.config; 34 35 extern (C): 36 37 alias _GRand GRand; 38 39 struct _GRand; 40 41 42 version(Derelict_Link_Static) 43 { 44 extern( C ) nothrow 45 { 46 GRand* g_rand_new_with_seed(guint32 seed); 47 GRand* g_rand_new_with_seed_array(const(guint32)* seed, guint seed_length); 48 GRand* g_rand_new(); 49 void g_rand_free(GRand* rand_); 50 GRand* g_rand_copy(GRand* rand_); 51 void g_rand_set_seed(GRand* rand_, guint32 seed); 52 void g_rand_set_seed_array(GRand* rand_, const(guint32)* seed, guint seed_length); 53 guint32 g_rand_int(GRand* rand_); 54 gint32 g_rand_int_range(GRand* rand_, gint32 begin, gint32 end); 55 gdouble g_rand_double(GRand* rand_); 56 gdouble g_rand_double_range(GRand* rand_, gdouble begin, gdouble end); 57 void g_random_set_seed(guint32 seed); 58 guint32 g_random_int(); 59 gint32 g_random_int_range(gint32 begin, gint32 end); 60 gdouble g_random_double(); 61 gdouble g_random_double_range(gdouble begin, gdouble end); 62 } 63 } 64 else 65 { 66 extern( C ) nothrow 67 { 68 alias da_g_rand_new_with_seed = GRand* function(guint32 seed); 69 alias da_g_rand_new_with_seed_array = GRand* function(const(guint32)* seed, guint seed_length); 70 alias da_g_rand_new = GRand* function(); 71 alias da_g_rand_free = void function(GRand* rand_); 72 alias da_g_rand_copy = GRand* function(GRand* rand_); 73 alias da_g_rand_set_seed = void function(GRand* rand_, guint32 seed); 74 alias da_g_rand_set_seed_array = void function(GRand* rand_, const(guint32)* seed, guint seed_length); 75 alias da_g_rand_int = guint32 function(GRand* rand_); 76 alias da_g_rand_int_range = gint32 function(GRand* rand_, gint32 begin, gint32 end); 77 alias da_g_rand_double = gdouble function(GRand* rand_); 78 alias da_g_rand_double_range = gdouble function(GRand* rand_, gdouble begin, gdouble end); 79 alias da_g_random_set_seed = void function(guint32 seed); 80 alias da_g_random_int = guint32 function(); 81 alias da_g_random_int_range = gint32 function(gint32 begin, gint32 end); 82 alias da_g_random_double = gdouble function(); 83 alias da_g_random_double_range = gdouble function(gdouble begin, gdouble end); 84 } 85 86 __gshared 87 { 88 da_g_rand_new_with_seed g_rand_new_with_seed; 89 da_g_rand_new_with_seed_array g_rand_new_with_seed_array; 90 da_g_rand_new g_rand_new; 91 da_g_rand_free g_rand_free; 92 da_g_rand_copy g_rand_copy; 93 da_g_rand_set_seed g_rand_set_seed; 94 da_g_rand_set_seed_array g_rand_set_seed_array; 95 da_g_rand_int g_rand_int; 96 da_g_rand_int_range g_rand_int_range; 97 da_g_rand_double g_rand_double; 98 da_g_rand_double_range g_rand_double_range; 99 da_g_random_set_seed g_random_set_seed; 100 da_g_random_int g_random_int; 101 da_g_random_int_range g_random_int_range; 102 da_g_random_double g_random_double; 103 da_g_random_double_range g_random_double_range; 104 } 105 }